import http from '@/util/http.js';


//获取角色列表

export function roleList(pagination, param) {
	let url = `/manager/role/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}


//添加角色
export function roleAdd(param) {
	let url = `/manager/role/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据角色ID修改角色
export function roleUpdate(id,param) {
	let url = `/manager/role/update/${id}`;

	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}




 //根据角色ID删除数据
 export function roleDel(id) {
 	let url = `/manager/role/delete/${id}`;
 	return new Promise((resolve, reject) => {
 		http.delete(url).then(response => {
 			resolve(response)
 		})
 	});
 }




//根据角色ID获取数据权限
export function rolePermission(id) {

	let url = `/manager/role/permission/${id}`;

	return new Promise((resolve, reject) => {
		http.get(url).then(response => {
			resolve(response)
		})
	});
}


/********************操作员API******************************/


//获取操作员列表
export function operatorList(pagination, param) {
	let url = `/manager/operator/list/${pagination.pageSize}/${pagination.current}`;
	return new Promise((resolve, reject) => {
		http.get(url, param).then(response => {
			resolve(response)
		});
	});
}

//添加操作员
export function operatorAdd(param) {
	let url = `/manager/operator/add`;
	return new Promise((resolve, reject) => {
		http.post(url, param).then(response => {
			resolve(response)
		})
	});
}


//根据操作员ID修改操作员
export function operatorUpdate(id,param) {
	let url = `/manager/operator/update/${id}`;
	return new Promise((resolve, reject) => {
		http.put(url, param).then(response => {
			resolve(response)
		})
	});
}


 //根据操作员ID删除操作员
 export function operatorDel(id) {
 	let url = `/manager/operator/delete/${id}`;
 	return new Promise((resolve, reject) => {
 		http.delete(url).then(response => {
 			resolve(response)
 		})
 	});
 }


 //根据操作员ID获取操作员权限列表
 export function operatorRoleList(id) {
 	let url = `/manager/operator/roleList/${id}`;
 	return new Promise((resolve, reject) => {
 		http.get(url).then(response => {
 			resolve(response)
 		})
 	});
 }



